# -*- coding: utf-8 -*-
"""
@Author: Logan
@Date:   2025/7/11 14:44
@Description: 
"""


class TradingMarketBase:
    def search_input(self):
        """
        交易市场搜索框
        :return:
        """
        return "//div[text()='搜索宝贝']/following-sibling::input"

    def search_button(self):
        """
        搜索按钮
        :return:
        """
        return "//i[@class='el-icon-search']/parent::button"

    def goods_card(self, goods_title):
        """
        商品卡片
        :param goods_title:
        :return:
        """
        return f"(//div[contains(text(),{goods_title})]/ancestor::div[@class='el-card__body'])[1]"

    def i_want_button(self):
        """
        我想要按钮
        :return:
        """
        return "//span[text()='我想要']/parent::button"

    def goods_nums(self):
        """
        购买数量
        :return:
        """
        return "//div[@class='el-input el-input--small']/input"

    def receive_address(self):
        """
        收货地址
        :return:
        """
        return "//input[@placeholder='收货地址']"

    def receive_address_detail(self, num, address=None):
        """
        具体的收货地址
        :param num:
        :param address:
        :return:
        """
        if address:
            return "//span[text()='" + address + "']/parent::li"
        else:
            return "//ul[contains(@class,'list')]/li[" + str(num) + "]"

    def bottom_confirm(self):
        """
        确定按钮
        :return:
        """
        return "//span[text()='确 定']/parent::button"
